package com.pengpeng.android.logic.main;

import com.baidu.mapapi.MKAddrInfo;
import com.baidu.mapapi.MKDrivingRouteResult;
import com.baidu.mapapi.MKPoiResult;
import com.baidu.mapapi.MKSearchListener;
import com.baidu.mapapi.MKTransitRouteResult;
import com.baidu.mapapi.MKWalkingRouteResult;
import com.baidu.mapapi.MapActivity;
import com.baidu.mapapi.MapView;
import com.baidu.mapapi.RouteOverlay;
import com.pengpeng.android.activity.BaiduMapActivity;

public class MySearchListener implements MKSearchListener {
	
	private BaiduMapActivity MyMapActivity=null;
	private MapView mMapView=null;
	
	public MySearchListener(BaiduMapActivity mbaidumap, MapView nMapView) {
		// TODO Auto-generated constructor stub
		MyMapActivity=mbaidumap;
		mMapView=nMapView;
	}


	@Override
	public void onGetAddrResult(MKAddrInfo arg0, int arg1) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onGetDrivingRouteResult(MKDrivingRouteResult result, int arg1) {
		// TODO Auto-generated method stub
		if (result == null) {
			return;
			}
			RouteOverlay routeOverlay = new RouteOverlay(MyMapActivity, mMapView);
			// 此处仅展示一个方案作为示例
			routeOverlay.setData(result.getPlan(0).getRoute(0));
			mMapView.getOverlays().add(routeOverlay);
	}

	@Override
	public void onGetPoiResult(MKPoiResult arg0, int arg1, int arg2) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onGetTransitRouteResult(MKTransitRouteResult arg0, int arg1) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onGetWalkingRouteResult(MKWalkingRouteResult arg0, int arg1) {
		// TODO Auto-generated method stub

	}

}
